13. One Solution

09 One Solution V2

model.eval()

There is an omission in the above code: including model.eval() !

model.eval() will set all the layers in your model to evaluation mode. This affects layers like dropout layers that turn "off" nodes during training with some probability, but should allow every node to be "on" for evaluation. So, you should set your model to evaluation mode before testing or validating your model and set it to model.train() (training mode) only during the training loop.

This is reflected in the previous notebook code and in our Github repository .

Optional Resources

  • Check out the first research paper to propose dropout as a technique for overfitting.
  • If you'd like more information on activation functions, check out this website .